
package galcon.utils;

public class Point {
	protected int	x, y;
	
	public Point (int x, int y) {
		this.x = x;
		this.y = y;
	}
	
	public int getX () {
		return x;
	}
	
	public int getY () {
		return y;
	}
	
	public void setX (int x) {
		this.x = x;
	}
	
	public void setY (int y) {
		this.y = y;
	}
	
	// returns the euclidean distance between this and other
	public double distance (Point other) {
		return Math.hypot (other.x - this.x, other.y - this.y);
	}

    public boolean equals(Object obj){
        if(obj instanceof Point){
            Point point = (Point) obj;
            if(this.getY() == point.getY() &&
                    this.getX() == point.getX()){
                return true;
            }
        }
        return false;
    }

    public String toString(){
        return "Point: x: " + this.getX() + " y: " + this.getY();
    }
}
